/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.ignite.internal.fileio;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;

/**
 * Decorator class for {@link FileIo}.
 */
public class FileIoDecorator extends AbstractFileIo {
    /** File I/O delegate. */
    protected final FileIo delegate;

    /**
     * Constructor.
     *
     * @param delegate {@link FileIo} delegate.
     */
    public FileIoDecorator(FileIo delegate) {
        this.delegate = delegate;
    }

    /** {@inheritDoc} */
    @Override
    public long position() throws IOException {
        return delegate.position();
    }

    /** {@inheritDoc} */
    @Override
    public void position(long newPosition) throws IOException {
        delegate.position(newPosition);
    }

    /** {@inheritDoc} */
    @Override
    public int read(ByteBuffer destBuf) throws IOException {
        return delegate.read(destBuf);
    }

    /** {@inheritDoc} */
    @Override
    public int read(ByteBuffer destBuf, long position) throws IOException {
        return delegate.read(destBuf, position);
    }

    /** {@inheritDoc} */
    @Override
    public int read(byte[] buf, int off, int len) throws IOException {
        return delegate.read(buf, off, len);
    }

    /** {@inheritDoc} */
    @Override
    public int write(ByteBuffer srcBuf) throws IOException {
        return delegate.write(srcBuf);
    }

    /** {@inheritDoc} */
    @Override
    public int write(ByteBuffer srcBuf, long position) throws IOException {
        return delegate.write(srcBuf, position);
    }

    /** {@inheritDoc} */
    @Override
    public int write(byte[] buf, int off, int len) throws IOException {
        return delegate.write(buf, off, len);
    }

    /** {@inheritDoc} */
    @Override
    public MappedByteBuffer map(int sizeBytes) throws IOException {
        return delegate.map(sizeBytes);
    }

    /** {@inheritDoc} */
    @Override
    public void force() throws IOException {
        delegate.force();
    }

    /** {@inheritDoc} */
    @Override
    public void force(boolean withMetadata) throws IOException {
        delegate.force(withMetadata);
    }

    /** {@inheritDoc} */
    @Override
    public long size() throws IOException {
        return delegate.size();
    }

    /** {@inheritDoc} */
    @Override
    public void clear() throws IOException {
        delegate.clear();
    }

    /** {@inheritDoc} */
    @Override
    public void close() throws IOException {
        delegate.close();
    }
}
